from urldb.model import DeclarativeBase
from sqlalchemy import Column, ForeignKey, Index, Integer, String
from sqlalchemy.sql import func

class Url(DeclarativeBase):
    __tablename__ = 'url'
    id  = Column(Integer, primary_key=True)  
    url = Column(String)
#   timestamp = created

class UrlParam(DeclarativeBase):
    __tablename__ = 'url_param'
    
    id      = Column(Integer, primary_key=True)
    name    = Column(String)
    value   = Column(String)
    url_id  = Column(
        Integer,
        ForeignKey(Url.id),
        nullable=False
    )


class Response(DeclarativeBase):
    __tablename__ = 'response'
    
    id     = Column(Integer, primary_key=True)
    url    = Column(String)
    doc    = Column(String)
    url_id = Column(
        Integer,
        ForeignKey(Url.id),
        nullable=False
    )
